# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-dis3
pkgname=('python2-dis3' 'python-dis3')
_pkgname=dis3
pkgver=0.1.3
pkgrel=8
pkgdesc='Python 2.7 backport of the "dis" module from Python 3.5+.'
arch=('any')
url='https://pypi.org/project/dis3/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('b4131a07422c7271cdf37790b6724e4bdf40959e7feb7c99a8cdea102a2b416825e8204e1297c665a5e497f80ec59954da3823c31c4a3ee410f129b973a6330d')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-dis3() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-dis3() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

